<?
/*
$xmlString =<<<XML
<?xml version="1.0"?>
<books>
  <book isbn="978-1594489501">
    <title>A Thousand Splendid Suns</title>
    <author>Khaled Hosseini</author>
    <publisher>Riverhead Hardcover</publisher>
    <amazon_price>14.27</amazon_price>
  </book>
  <book isbn="978-1594489587">
    <title>The Brief Wondrous Life of Oscar Wao</title>
    <author>Junot Diaz</author>
    <publisher>Riverhead Hardcover</publisher>
    <amazon_price>14.97</amazon_price>
  </book>
  <book isbn="978-0545010221">
    <title>Harry Potter and the Deathly Hallows</title>
    <author>J. K. Rowling</author>
    <publisher>Arthur A. Levine Books</publisher>
    <amazon_price>19.24</amazon_price>
  </book>
</books>
XML;
*/

$myUrl ="http://api.citygridmedia.com/content/reviews/v2/search/latlon?lat=42.5984151&lon=-82.950717&radius=10&what=baldwin&publisher=10000001970"; 
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $myUrl);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
//print $result;
$xmlString =<<<XML
$result
XML;
$dom = new DOMDocument();
$dom->loadXML($xmlString);
foreach ($dom->childNodes as $node) {
	foreach ($node->childNodes as $node2) {
		if($node2->nodeName =="reviews"){
			foreach($node2->childNodes as $reviewNode){
				
				foreach($reviewNode->childNodes as $detailNode)
				print "Node Name: " . $detailNode->nodeName . ':<br>'. $detailNode->nodeValue . "<br>";
				
			}
		}
	} 
}




?>
